<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    
    <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Hugo 0.56.3 with theme Tranquilpeak 0.4.7-BETA">
<meta name="author" content="iFence">
<meta name="keywords" content="">
<meta name="description" content="一、需求 绝大多数大数据框架被设计应用在Linux系统上，对Windows系统的支持并不是很好。但是大多数人的开环境还是Window系统，这样就必然造成矛盾。使用Windows&#43;虚拟机的方式占用系统资源不说，整个操作过程过于繁琐。出于种种原因的考虑，使用Windows内置Linux">


<meta property="og:description" content="一、需求 绝大多数大数据框架被设计应用在Linux系统上，对Windows系统的支持并不是很好。但是大多数人的开环境还是Window系统，这样就必然造成矛盾。使用Windows&#43;虚拟机的方式占用系统资源不说，整个操作过程过于繁琐。出于种种原因的考虑，使用Windows内置Linux">
<meta property="og:type" content="article">
<meta property="og:title" content="使用WSL进行大数据开发">
<meta name="twitter:title" content="使用WSL进行大数据开发">
<meta property="og:url" content="https://ifence.gitee.io/2019/08/%E4%BD%BF%E7%94%A8wsl%E8%BF%9B%E8%A1%8C%E5%A4%A7%E6%95%B0%E6%8D%AE%E5%BC%80%E5%8F%91/">
<meta property="twitter:url" content="https://ifence.gitee.io/2019/08/%E4%BD%BF%E7%94%A8wsl%E8%BF%9B%E8%A1%8C%E5%A4%A7%E6%95%B0%E6%8D%AE%E5%BC%80%E5%8F%91/">
<meta property="og:site_name" content="iFence&#39;s Nest">
<meta property="og:description" content="一、需求 绝大多数大数据框架被设计应用在Linux系统上，对Windows系统的支持并不是很好。但是大多数人的开环境还是Window系统，这样就必然造成矛盾。使用Windows&#43;虚拟机的方式占用系统资源不说，整个操作过程过于繁琐。出于种种原因的考虑，使用Windows内置Linux">
<meta name="twitter:description" content="一、需求 绝大多数大数据框架被设计应用在Linux系统上，对Windows系统的支持并不是很好。但是大多数人的开环境还是Window系统，这样就必然造成矛盾。使用Windows&#43;虚拟机的方式占用系统资源不说，整个操作过程过于繁琐。出于种种原因的考虑，使用Windows内置Linux">
<meta property="og:locale" content="zh-cn">

  
    <meta property="article:published_time" content="2019-08-04T14:58:10">
  
  
    <meta property="article:modified_time" content="2019-08-04T14:58:10">
  
  
  
    
      <meta property="article:section" content="Linux">
    
  
  
    
      <meta property="article:tag" content="WSL">
    
      <meta property="article:tag" content="Linux">
    
      <meta property="article:tag" content="Big Data">
    
  


<meta name="twitter:card" content="summary">











  <meta property="og:image" content="https://avatars1.githubusercontent.com/u/53120100?s=460&v=4">
  <meta property="twitter:image" content="https://avatars1.githubusercontent.com/u/53120100?s=460&v=4">


    <title>使用WSL进行大数据开发</title>

    <link rel="icon" href="https://ifence.gitee.io/favicon.png">
    

    

    <link rel="canonical" href="https://ifence.gitee.io/2019/08/%E4%BD%BF%E7%94%A8wsl%E8%BF%9B%E8%A1%8C%E5%A4%A7%E6%95%B0%E6%8D%AE%E5%BC%80%E5%8F%91/">

    
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/jquery.fancybox.min.css" integrity="sha256-vuXZ9LGmmwtjqFX1F+EKin1ThZMub58gKULUyf0qECk=" crossorigin="anonymous" />
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.4/helpers/jquery.fancybox-thumbs.min.css" integrity="sha256-SEa4XYAHihTcEP1f5gARTB2K26Uk8PsndQYHQC1f4jU=" crossorigin="anonymous" />
    
    
    <link rel="stylesheet" href="https://ifence.gitee.io/css/style-twzjdbqhmnnacqs0pwwdzcdbt8yhv8giawvjqjmyfoqnvazl0dalmnhdkvp7.min.css" />
    
    

    
      
<script type="application/javascript">
var doNotTrack = false;
if (!doNotTrack) {
	(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
	})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
	ga('create', 'UA-123-45', 'auto');
	
	ga('send', 'pageview');
}
</script>

    
    
  </head>

  <body>
    <div id="blog">
      <header id="header" data-behavior="5">
  <i id="btn-open-sidebar" class="fa fa-lg fa-bars"></i>
  <div class="header-title">
    <a class="header-title-link" href="https://ifence.gitee.io/">iFence&#39;s Nest</a>
  </div>
  
    
      <a class="header-right-picture "
         href="https://ifence.gitee.io/#about">
    
    
    
      
        <img class="header-picture" src="https://avatars1.githubusercontent.com/u/53120100?s=460&amp;v=4" alt="作者的图片" />
      
    
    </a>
  
</header>

      <nav id="sidebar" data-behavior="5">
  <div class="sidebar-container">
    
      <div class="sidebar-profile">
        <a href="https://ifence.gitee.io/#about">
          <img class="sidebar-profile-picture" src="https://avatars1.githubusercontent.com/u/53120100?s=460&amp;v=4" alt="作者的图片" />
        </a>
        <h4 class="sidebar-profile-name">iFence</h4>
        
          <h5 class="sidebar-profile-bio">虽千万人吾往矣</h5>
        
      </div>
    
    <ul class="sidebar-buttons">
      
  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://ifence.gitee.io/">
    
      <i class="sidebar-button-icon fa fa-lg fa-home"></i>
      
      <span class="sidebar-button-desc">首页</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://ifence.gitee.io/archives">
    
      <i class="sidebar-button-icon fa fa-lg fa-archive"></i>
      
      <span class="sidebar-button-desc">归档</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://ifence.gitee.io/tags">
    
      <i class="sidebar-button-icon fa fa-lg fa-tags"></i>
      
      <span class="sidebar-button-desc">标签</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://ifence.gitee.io/categories">
    
      <i class="sidebar-button-icon fa fa-lg fa-bookmark"></i>
      
      <span class="sidebar-button-desc">分类</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://ifence.gitee.io/about">
    
      <i class="sidebar-button-icon fa fa-lg fa-user"></i>
      
      <span class="sidebar-button-desc">关于</span>
    </a>
  </li>


    </ul>
    <ul class="sidebar-buttons">
      
  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://github.com/iFence" target="_blank" rel="noopener">
    
      <i class="sidebar-button-icon fa fa-lg fa-github"></i>
      
      <span class="sidebar-button-desc">GitHub</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://blog.csdn.net/Vector97" target="_blank" rel="noopener">
    
      <i class="sidebar-button-icon fa fa-lg fa-codiepie"></i>
      
      <span class="sidebar-button-desc">CSDN</span>
    </a>
  </li>

  <li class="sidebar-button">
    
      <a class="sidebar-button-link " href="https://www.jianshu.com/u/424596d51c5a" target="_blank" rel="noopener">
    
      <i class="sidebar-button-icon fa fa-lg fa-gratipay"></i>
      
      <span class="sidebar-button-desc">简书</span>
    </a>
  </li>


    </ul>
    <ul class="sidebar-buttons">
      

    </ul>
  </div>
</nav>

      

      <div id="main" data-behavior="5"
        class="
               hasCoverMetaIn
               ">
        <article class="post" itemscope itemType="http://schema.org/BlogPosting">
          
          
            <div class="post-header main-content-wrap text-left">
  
    <h1 class="post-title" itemprop="headline">
      使用WSL进行大数据开发
    </h1>
  
  
  <div class="postShorten-meta post-meta">
    
      <time itemprop="datePublished" datetime="2019-08-04T14:58:10&#43;08:00">
        
  八月 4, 2019

      </time>
    
    
  
  
    <span>发布在</span>
    
      <a class="category-link" href="https://ifence.gitee.io/categories/linux">Linux</a>
    
  

  </div>

</div>
          
          <div class="post-content markdown" itemprop="articleBody">
            <div class="main-content-wrap">
              

<h2 id="一-需求">一、需求</h2>

<p>绝大多数大数据框架被设计应用在Linux系统上，对Windows系统的支持并不是很好。但是大多数人的开环境还是Window系统，这样就必然造成矛盾。使用Windows+虚拟机的方式占用系统资源不说，整个操作过程过于繁琐。出于种种原因的考虑，使用Windows内置Linux系统的方案可能是在本地进行简单学习、测试大数据框架的最佳方案。</p>

<h2 id="二-安装linux子系统">二、安装Linux子系统</h2>

<p>打开Window应用商店，搜索Ubuntu（Ubuntu与Centos的常用命令大部分通用），找到以后点击安装，如图</p>

<p><img src="https://ifence.gitee.io/nis/b1.jpg" alt="" /></p>

<p>由于我已经装过了，所以上图显示的是启动，等待下载安装完成以后，可以点击启动Ubuntu。试着输入<code>df -Th</code>命令查看系统挂载点，如图：</p>

<p><img src="https://ifence.gitee.io/nis/b2.jpg" alt="" /></p>

<p>上图可以看到两个问题，第一，启动用户默认是普通用户，在装大数据框架的时候需要设置环境变量，使用普通用户是无法修改<code>/etc/profile</code>文件的，其次可以看到Windows硬盘被挂载到了<code>/mnt</code>目录下</p>

<p>针对上面的问题，首先将用户切换为<code>root</code>.打开window系统的cmd，输入<code>ubuntu config --default-user root</code>,然后重启Ubuntu，可以发现用户已经切换了。</p>

<p>如上文提及的,Linux 系统的关键文件位置都如同真正Linux系统的文件位置一样，不用担心找不到关键文件的问题。系统本机文件，可以进入<code>/mnt</code>下找到相应的盘，然后查找相应的文件。</p>

<p>至此，Windows的Linux子系统已经安装配置完成了</p>

<h2 id="三-在子系统中安装大数据服务-以flink为例">三、在子系统中安装大数据服务——以flink为例</h2>

<p>安装Flink首先需要安装jdk1.8。注意这里安装的jdk及flink与在真正Linux系统安装步骤一样。</p>

<ol>
<li><p>下载jdk，后缀为<code>tar.gz</code>的安装包，这里我解压到了<code>/mnt/d/Apps</code>目录下</p>

<pre><code class="language-bash">tar -zxvf /mnt/d/Apps/jdk1.8.0_211
</code></pre></li>

<li><p>配置环境变量</p>

<pre><code class="language-bash">vim /etc/profile
#Java
export JAVA_HOME=/mnt/d/Apps/jdk1.8.0_211
export PATH=$PATH:$JAVA_HOME/bin
</code></pre></li>

<li><p>解压flink到/mnt/d/Apps目录下，并配置环境变量</p></li>

<li><p>使配置文件生效</p></li>

<li><p>使用<code>start-cluster.sh</code>启动flink服务</p></li>

<li><p>输入jps查看进程</p></li>
</ol>

<p><img src="https://ifence.gitee.io/nis/b4.jpg" alt="" /></p>

<p>这时候发现flink服务已经启动起来了</p>

<ol>
<li>输入浏览器<code>localhost:8081</code>查看flink的Web UI，成功</li>
</ol>

<p><img src="https://ifence.gitee.io/nis/b4.5.jpg" alt="" /></p>

<ol>
<li><p>开发好应用以后，进入到flink安装目录下运行应用</p>

<pre><code class="language-bash">./bin/flink run examples/streaming/SocketWindowWordCount.jar --port 9000
</code></pre></li>

<li><p>再次查看web UI，任务已经提交，并且有结果产生了</p></li>
</ol>

<p><img src="https://ifence.gitee.io/nis/b5.jpg" alt="" /></p>

<p>至此，结束。使用内置Linux开发、测试大数据应用简洁，方便！</p>

<h2 id="四-不足">四、不足</h2>

<p>子系统只能测试环境使用，较为复杂的环境，一台Linux捉襟见肘。</p>

              
            </div>
          </div>
          <div id="post-footer" class="post-footer main-content-wrap">
            
              
                
                
                  <div class="post-footer-tags">
                    <span class="text-color-light text-small">标签</span><br/>
                    
  <a class="tag tag--primary tag--small" href="https://ifence.gitee.io/tags/wsl/">WSL</a>

  <a class="tag tag--primary tag--small" href="https://ifence.gitee.io/tags/linux/">Linux</a>

  <a class="tag tag--primary tag--small" href="https://ifence.gitee.io/tags/big-data/">Big Data</a>

                  </div>
                
              
            
            <div class="post-actions-wrap">
  
      <nav >
        <ul class="post-actions post-action-nav">
          
            <li class="post-action">
              
                <a class="post-action-btn btn btn--default tooltip--top" href="https://ifence.gitee.io/2019/08/map%E5%92%8Cflatmap%E7%9A%84%E5%8C%BA%E5%88%AB/" data-tooltip="Map和Flatmap的区别">
              
                  <i class="fa fa-angle-left"></i>
                  <span class="hide-xs hide-sm text-small icon-ml">下一篇</span>
                </a>
            </li>
            <li class="post-action">
              
                <a class="post-action-btn btn btn--disabled">
              
                  <span class="hide-xs hide-sm text-small icon-mr">上一篇</span>
                  <i class="fa fa-angle-right"></i>
                </a>
            </li>
          
        </ul>
      </nav>
    <ul class="post-actions post-action-share" >
      
        <li class="post-action hide-lg hide-md hide-sm">
          <a class="post-action-btn btn btn--default btn-open-shareoptions" href="#btn-open-shareoptions">
            <i class="fa fa-share-alt"></i>
          </a>
        </li>
        
      
      
        <li class="post-action">
          <a class="post-action-btn btn btn--default" href="#disqus_thread">
            <i class="fa fa-comment-o"></i>
          </a>
        </li>
      
      <li class="post-action">
        
          <a class="post-action-btn btn btn--default" href="#">
        
          <i class="fa fa-list"></i>
        </a>
      </li>
    </ul>
  
</div>

            
              
                <div id="disqus_thread">
  <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
              
            
          </div>
        </article>
        <footer id="footer" class="main-content-wrap">
  <span class="copyrights">
    &copy; 2019 iFence. All Rights Reserved
  </span>
</footer>

      </div>
      <div id="bottom-bar" class="post-bottom-bar" data-behavior="5">
        <div class="post-actions-wrap">
  
      <nav >
        <ul class="post-actions post-action-nav">
          
            <li class="post-action">
              
                <a class="post-action-btn btn btn--default tooltip--top" href="https://ifence.gitee.io/2019/08/map%E5%92%8Cflatmap%E7%9A%84%E5%8C%BA%E5%88%AB/" data-tooltip="Map和Flatmap的区别">
              
                  <i class="fa fa-angle-left"></i>
                  <span class="hide-xs hide-sm text-small icon-ml">下一篇</span>
                </a>
            </li>
            <li class="post-action">
              
                <a class="post-action-btn btn btn--disabled">
              
                  <span class="hide-xs hide-sm text-small icon-mr">上一篇</span>
                  <i class="fa fa-angle-right"></i>
                </a>
            </li>
          
        </ul>
      </nav>
    <ul class="post-actions post-action-share" >
      
        <li class="post-action hide-lg hide-md hide-sm">
          <a class="post-action-btn btn btn--default btn-open-shareoptions" href="#btn-open-shareoptions">
            <i class="fa fa-share-alt"></i>
          </a>
        </li>
        
      
      
        <li class="post-action">
          <a class="post-action-btn btn btn--default" href="#disqus_thread">
            <i class="fa fa-comment-o"></i>
          </a>
        </li>
      
      <li class="post-action">
        
          <a class="post-action-btn btn btn--default" href="#">
        
          <i class="fa fa-list"></i>
        </a>
      </li>
    </ul>
  
</div>

      </div>
      <div id="share-options-bar" class="share-options-bar" data-behavior="5">
  <i id="btn-close-shareoptions" class="fa fa-close"></i>
  <ul class="share-options">
    
  </ul>
</div>
<div id="share-options-mask" class="share-options-mask"></div>
    </div>
    
    <div id="about">
  <div id="about-card">
    <div id="about-btn-close">
      <i class="fa fa-remove"></i>
    </div>
    
      <img id="about-card-picture" src="https://avatars1.githubusercontent.com/u/53120100?s=460&amp;v=4" alt="作者的图片" />
    
    <h4 id="about-card-name">iFence</h4>
    
      <div id="about-card-bio">虽千万人吾往矣</div>
    
    
      <div id="about-card-job">
        <i class="fa fa-briefcase"></i>
        <br/>
        大数据开发
      </div>
    
    
      <div id="about-card-location">
        <i class="fa fa-map-marker"></i>
        <br/>
        中国 山东
      </div>
    
  </div>
</div>

    

    
  
    
      <div id="cover" style="background-image:url('https://ifence.gitee.io/images/cover.jpg');"></div>
    
  


    
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js" integrity="sha256-/BfiIkHlHoVihZdc6TFuj7MmJ0TWcWsMXkeDFwhi0zw=" crossorigin="anonymous"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.7/js/jquery.fancybox.min.js" integrity="sha256-GEAnjcTqVP+vBp3SSc8bEDQqvWAZMiHyUSIorrWwH50=" crossorigin="anonymous"></script>


<script src="https://ifence.gitee.io/js/script-pcw6v3xilnxydl1vddzazdverrnn9ctynvnxgwho987mfyqkuylcb1nlt.min.js"></script>


<script lang="javascript">
window.onload = updateMinWidth;
window.onresize = updateMinWidth;
document.getElementById("sidebar").addEventListener("transitionend", updateMinWidth);
function updateMinWidth() {
  var sidebar = document.getElementById("sidebar");
  var main = document.getElementById("main");
  main.style.minWidth = "";
  var w1 = getComputedStyle(main).getPropertyValue("min-width");
  var w2 = getComputedStyle(sidebar).getPropertyValue("width");
  var w3 = getComputedStyle(sidebar).getPropertyValue("left");
  main.style.minWidth = `calc(${w1} - ${w2} - ${w3})`;
}
</script>

<script>
$(document).ready(function() {
  hljs.configure({ classPrefix: '', useBR: false });
  $('pre.code-highlight > code, pre > code').each(function(i, block) {
    if (!$(this).hasClass('codeblock')) {
      $(this).addClass('codeblock');
    }
    hljs.highlightBlock(block);
  });
});
</script>


  
    
      <script>
        var disqus_config = function () {
          this.page.url = 'https:\/\/ifence.gitee.io\/2019\/08\/%E4%BD%BF%E7%94%A8wsl%E8%BF%9B%E8%A1%8C%E5%A4%A7%E6%95%B0%E6%8D%AE%E5%BC%80%E5%8F%91\/';
          
            this.page.identifier = '\/2019\/08\/%E4%BD%BF%E7%94%A8wsl%E8%BF%9B%E8%A1%8C%E5%A4%A7%E6%95%B0%E6%8D%AE%E5%BC%80%E5%8F%91\/'
          
        };
        (function() {
          
          
          if (window.location.hostname == "localhost") {
            return;
          }
          var d = document, s = d.createElement('script');
          var disqus_shortname = 'hugo-tranquilpeak-theme';
          s.src = '//' + disqus_shortname + '.disqus.com/embed.js';

          s.setAttribute('data-timestamp', +new Date());
          (d.head || d.body).appendChild(s);
        })();
      </script>
    
  




    
  </body>
</html>

